package com.ruoyi.group.service.impl;

import com.ruoyi.group.domain.Qualitied;
import com.ruoyi.group.domain.RpRepairOrder;
import com.ruoyi.group.domain.dto.QualitiedDealDto;
import com.ruoyi.group.mapper.QualitiedMapper;
import com.ruoyi.group.mapper.RepairOrderMapper;
import com.ruoyi.group.service.QualitiedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author: CHL  <br/>
 * @ToDo: <br>
 * Date: 2022/3/14:10:40  <br/>
 * Description:
 */
@Service
public class QualitiedServiceImpl implements QualitiedService {
    @Autowired
    QualitiedMapper qualitiedMapper;
    @Autowired
    RepairOrderMapper repairOrderMapper;
    @Override
    public int add(Qualitied qualitied) {
        return qualitiedMapper.add(qualitied);
    }

    @Override
    public Qualitied findByOrderId(int orderId) {
        return qualitiedMapper.findByOrderId(orderId);
    }
    //对前端传过来的参数集合体进行处理（分别插入一个中间表和质检表）
    @Override
    public int qualitiedByOrderId(QualitiedDealDto qualitiedDealDto) {
        int success = qualitiedMapper.qualitiedByOrderId(qualitiedDealDto);
        Integer repairId = qualitiedDealDto.getRepairId();
        repairOrderMapper.changeStatus(repairId);
        return success;
    }
}
